//
//  Secret.h
//  ReactNativeIOS
//
//  Created by FishWithoutWings on 2018/1/8.
//  Copyright © 2018年 chenliang. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (md5)

- (NSString *)md5;

@end

@interface RSA : NSObject

// return base64 encoded string
+ (NSString *)encryptString:(NSString *)str publicKeyFile:(NSString *)derFilePath;
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;
// return raw data
+ (NSData *)encryptData:(NSData *)data publicKeyFile:(NSString *)derFilePath;
+ (NSData *)encryptData:(NSData *)data publicKey:(NSString *)pubKey;
// return base64 encoded string
// enc with private key NOT working YET!
//+ (NSString *)encryptString:(NSString *)str privateKeyFile:(NSString *)p12FilePath password:(NSString *)p12password
//+ (NSString *)encryptString:(NSString *)str privateKey:(NSString *)privKey;
// return raw data
//+ (NSData *)encryptData:(NSData *)data privateKeyFile:(NSString *)p12FilePath password:(NSString *)p12password;
//+ (NSData *)encryptData:(NSData *)data privateKey:(NSString *)privKey;

// decrypt base64 encoded string, convert result to string(not base64 encoded)
+ (NSString *)decryptString:(NSString *)str publicKeyFile:(NSString *)derFilePath;
+ (NSString *)decryptString:(NSString *)str publicKey:(NSString *)pubKey;
+ (NSData *)decryptData:(NSData *)data publicKeyFile:(NSString *)derFilePath;
+ (NSData *)decryptData:(NSData *)data publicKey:(NSString *)pubKey;
+ (NSString *)decryptString:(NSString *)str privateKeyFile:(NSString *)p12FilePath password:(NSString *)p12password;
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;
+ (NSData *)decryptData:(NSData *)data privateKeyFile:(NSString *)p12FilePath password:(NSString *)p12password;
+ (NSData *)decryptData:(NSData *)data privateKey:(NSString *)privKey;

@end
